package persistencia;

import java.io.IOException;
import java.util.ArrayList;
import java.util.List;

import modelo.Cliente;
import org.ksoap2.serialization.PropertyInfo;
import org.ksoap2.serialization.SoapObject;

import org.xmlpull.v1.XmlPullParserException;

public class DALCliente {

	public Cliente LerCliente(int IdCliente) throws IOException, XmlPullParserException {
		
		List<PropertyInfo> lsPI = new ArrayList<PropertyInfo>();
		PropertyInfo pi = new PropertyInfo();
		pi.setName("lngIdCliente");
		pi.setValue(IdCliente);
		lsPI.add(pi);
				
		WebServices ws = new WebServices();
		SoapObject result = ws.WebServices("LerDadosCliente",lsPI);
				
		Cliente Cl = new Cliente();
		
		if (result != null){
				
			Cl.setIdCliente(result.getProperty("idCliente").toString());
			Cl.setNome(result.getProperty("Nome").toString());
			Cl.setEndereco(result.getProperty("Endereco").toString());
			Cl.setLatitude(result.getProperty("Latit").toString());
			Cl.setLongitude(result.getProperty("Longi").toString());
						
		}else 
			Cl = null;
				
		return Cl;
	
	}

}